import { ElMessageBox } from 'element-plus'

interface ConfirmOptions {
  title?: string
  confirmButtonText?: string
  cancelButtonText?: string
  type?: 'success' | 'warning' | 'info' | 'error'
}

interface AlertOptions {
  title?: string
  confirmButtonText?: string
  type?: 'success' | 'warning' | 'info' | 'error'
  callback?: () => void
}

export const messageBox = {
  confirm(message: string, options: ConfirmOptions = {}) {
    const {
      title = '提示',
      confirmButtonText = '确定',
      cancelButtonText = '取消',
      type = 'warning'
    } = options

    return ElMessageBox.confirm(message, title, {
      confirmButtonText,
      cancelButtonText,
      type
    }).catch(() => false)
  },

  alert(message: string, options: AlertOptions = {}) {
    const {
      title = '提示',
      confirmButtonText = '确定',
      type = 'info',
      callback
    } = options

    return ElMessageBox.alert(message, title, {
      confirmButtonText,
      type,
      callback
    })
  }
} 